How to avoid code repetition and redundancy

welcome to shbcf.ru